﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace School
{
    public class Student
    {
        public int FacultyNumber { get; set; }
        public string Name
        {
            get
            {
                return this.Name;
            }
            set
            {
                if (value == string.Empty)
                {
                    throw new ArgumentException("Name can not be empty");
                }
            }
        }

        public Student(int facultyNumber, string name)
        {
            this.FacultyNumber = facultyNumber;
            this.Name = name;
        }

        public override string ToString()
        {
            return string.Format("FacultyNumber: {0}, Name: {1}", FacultyNumber, Name);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = 17;
                result = result * 23 + this.FacultyNumber.GetHashCode();
                return result;
            }
        }

        public bool Equals(Student value)
        {
            return this.FacultyNumber == value.FacultyNumber;
        }

        public override bool Equals(object obj)
        {
            Student temp = obj as Student;
            if (temp == null) return false;
            return this.Equals(temp);
        }
    }
}
